From daab95c294c90116db63c91979c96d444318c17b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 14 Jun 2005 20:43:20 +0000 Subject: [PATCH] Add a stub for the no-Xcursor case. (noticed by Luis Villa) 2005-06-14 Matthias Clasen * gdk/x11/gdkcursor-x11.c (gdk_cursor_new_from_name): Add a stub for the no-Xcursor case. (noticed by Luis Villa) --- ChangeLog | 3 ++ ChangeLog.pre-2-10 | 3 ++ ChangeLog.pre-2-8 | 3 ++ gdk/x11/gdkcursor-x11.c | 66 +++++++++++++++++++++++++++++++++++++++-- 4 files changed, 73 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee74125798..c620755c1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-06-14 Matthias Clasen + * gdk/x11/gdkcursor-x11.c (gdk_cursor_new_from_name): Add a + stub for the no-Xcursor case. (noticed by Luis Villa) + Use named cursors for the DND cursors, the names are "dnd-none", "dnd-copy", "dnd-link", "dnd-move" and "dnd-ask". Also use an RGBA cursor instead of cursor+window when possible. This saves diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ee74125798..c620755c1b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,8 @@ 2005-06-14 Matthias Clasen + * gdk/x11/gdkcursor-x11.c (gdk_cursor_new_from_name): Add a + stub for the no-Xcursor case. (noticed by Luis Villa) + Use named cursors for the DND cursors, the names are "dnd-none", "dnd-copy", "dnd-link", "dnd-move" and "dnd-ask". Also use an RGBA cursor instead of cursor+window when possible. This saves diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ee74125798..c620755c1b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,8 @@ 2005-06-14 Matthias Clasen + * gdk/x11/gdkcursor-x11.c (gdk_cursor_new_from_name): Add a + stub for the no-Xcursor case. (noticed by Luis Villa) + Use named cursors for the DND cursors, the names are "dnd-none", "dnd-copy", "dnd-link", "dnd-move" and "dnd-ask". Also use an RGBA cursor instead of cursor+window when possible. This saves diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c index b9c27fe2a0..3373ecdcfb 100644 --- a/gdk/x11/gdkcursor-x11.c +++ b/gdk/x11/gdkcursor-x11.c @@ -312,6 +312,34 @@ gdk_cursor_get_display (GdkCursor *cursor) #if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2 +#if 0 +XcursorComments * +load_comments (const char *file, + const char *theme) +{ + FILE *f = 0; + XcursorImages *images = 0; + XcursorComments *comments = 0; + + if (theme) + f = XcursorScanTheme (theme, file); + if (!f) + f = XcursorScanTheme ("default", file); + if (f == XCURSOR_SCAN_CORE) + return 0; + if (f) + { + XcursorFileLoad (f, &comments, &images); + fclose (f); + + if (images) + XcursorImagesDestroy (images); + } + + return comments; +} +#endif + /** * gdk_cursor_get_image: * @cursor: a #GdkCursor @@ -333,13 +361,15 @@ gdk_cursor_get_image (GdkCursor *cursor) GdkCursorPrivate *private; XcursorImages *images = NULL; XcursorImage *image; + XcursorComments *comments; Atom atom; gint size; gchar buf[32]; guchar *data; GdkPixbuf *pixbuf; gchar *theme; - + gint i, j; + g_return_val_if_fail (cursor != NULL, NULL); private = (GdkCursorPrivate *) cursor; @@ -376,7 +406,30 @@ gdk_cursor_get_image (GdkCursor *cursor) gdk_pixbuf_set_option (pixbuf, "x_hot", buf); g_snprintf (buf, 32, "%d", image->yhot); gdk_pixbuf_set_option (pixbuf, "y_hot", buf); - + +#if 0 + comments = load_comments (images->name, theme); + + j = 0; + for (i = 0; i < comments->ncomment; i++) + { + switch (comments->comments[i].comment_type) + { + case XCURSOR_COMMENT_COPYRIGHT: + gdk_pixbuf_set_option (pixbuf, "copyright", comments->comments[i].comment); + break; + case XCURSOR_COMMENT_LICENSE: + gdk_pixbuf_set_option (pixbuf, "license", comments->comments[i].comment); + break; + default: + g_snprintf (buf, 32, "comment%d", j++); + gdk_pixbuf_set_option (pixbuf, buf, comments->comments[i].comment); + break; + } + } + XcursorCommentsDestroy (comments); +#endif + XcursorImagesDestroy (images); return pixbuf; @@ -687,6 +740,15 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display, return cursor; } +GdkCursor* +gdk_cursor_new_from_name (GdkDisplay *display, + const gchar *name) +{ + g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); + + return NULL; +} + gboolean gdk_display_supports_cursor_alpha (GdkDisplay *display) { -- 2.30.2